package com.zm.openapi.filters.init;

import com.zm.openapi.utils.WebfluxHttpUtil;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @description: form data 形式  x=1&y=2&z=3
 * @module: com.zm.apigateway.Filters
 * @author: songxiongli
 * @date: 2020-03-14 20:27
 **/
@Component
public class FormdataHttpBodySerializer implements IHttpBodySerializer {
    @Override
    public Map<String, Object> serialize(String body) {
        return WebfluxHttpUtil.decodeBody(body);
    }

    @Override
    public String deserialize(Map<String, Object> bodyMap) {
        return WebfluxHttpUtil.encodeBody(bodyMap);
    }
}
